#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.common.exception;


import ${package}.common.emum.DadyEnum;
import ${package}.common.emum.ReturnCodeEnum;

/**
 * Description: BuinessException
 *
 * @author wupanhua
 * @date 2019/8/6 15:28
 *
 * <pre>
 *              ${copyright}
 *      Copyright (c) 2019. All Rights Reserved.
 * </pre>
 */
public class BusinessException extends RuntimeException {
    private final Integer code;

    public BusinessException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public BusinessException(String message) {
        super(message);
        this.code = ReturnCodeEnum.ERROR.getCode();
    }

    public BusinessException(DadyEnum dady) {
        this(dady.getMsg(), dady.getCode());
    }

    /**
     * Description:
     * <a general exception>
     * @author wenxiaopeng
     * @date 15:50 2020/04/09
     * @return
     **/
    public BusinessException() {
        this(ReturnCodeEnum.ERROR);
    }

    public Integer getCode() {
        return code;
    }
}
